from flask import Flask
from toutiao.config import Config
from toutiao.model.db_routing import db

app = Flask(__name__)


@app.route('/')
def hello_world():  # put application's code here
    return 'Hello World!'


def create_app():
    app = Flask(__name__)
    app.config.from_object(Config)
    # from toutiao.views.code import code_api
    # from toutiao.views.channel import channel_api
    # from toutiao.views.articles import article_api
    # app.register_blueprint(code_api)
    # app.register_blueprint(channel_api)
    # app.register_blueprint(article_api)
    with app.app_context():
        db.init_app(app)
        db.create_all()
    return app


app = create_app()

if __name__ == '__main__':
    app.run()
